<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>分类管理</title>
    <meta name="referrer" content="no-referrer"/>
    <link th:href="@{/css/bootstrap-3.3.7-dist/css/bootstrap.css}" rel="stylesheet">
    <link th:href="@{/css/bootstrap-3.3.7-dist/css/bootstrap-theme.css}" rel="stylesheet">
    <link th:href="@{/css/blog.css}" rel="stylesheet">
    <link th:href="@{/css/adminblog.css}" rel="stylesheet">
    <script type="text/javascript" th:src="@{/js/jquery-3.0.0.js}"></script>
    <script type="text/javascript" th:src="@{/js/jquery-3.0.0.min.js}"></script>
    <script type="text/javascript" th:src="@{/css/bootstrap-3.3.7-dist/js/bootstrap.js}"></script>
    <script type="text/javascript" th:src="@{/css/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
<!--    <script type="text/javascript" th:src="@{/css/bootstrap-3.3.7-dist/js/npm.js}"></script>-->
</head>
<body style="background-color: #F2F2F2">
<div th:replace="admin/adminblog::adminheader"></div>
<nav class="navbar m-padded-tb-mimi m-a-padded">
    <div class="container">
        <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a th:href="@{/admin/types/input}">发布</a></li>
                <li><a th:href="@{/admin/types}">列表</a></li>
            </ul>
        </div>
    </div>
</nav>
<div>
    <div class="container">
        <div class="alert alert-success alert-dismissible" role="alert" th:unless="${#strings.isEmpty(message)}">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <strong>提示：</strong><span th:text="${message}">恭喜，操作成功！</span>
        </div>
        <div class="panel panel-default">
            <div class="panel-body">
                <table class="table table-hover table-bordered">
                    <thead class="thead-dark">
                    <tr>
                        <th scope="col">#</th>
                        <th scope="col">名称</th>
                        <th scope="col">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="type,iterStat : ${page.content}">
                        <th scope="row" th:text="${iterStat.count}">1</th>
                        <td th:text="${type.name}"></td>
                        <td>
                            <a class="btn btn-info btn-xs" href="#" th:href="@{/admin/types/{id}/input(id=${type.id})}" role="button">编辑</a>
                            <a class="btn btn-danger btn-xs" href="#" th:href="@{/admin/types/{id}/delete(id=${type.id})}"  role="button">删除</a>
                        </td>
                    </tr>
                    </tbody>
                    <tfoot>
                    <tr>
                        <th colspan="2">
                            <nav aria-label="Page navigation" th:if="${page.totalPages}>1">
                                <ul class="pager">
                                    <li class="previous">
                                        <a th:href="@{/admin/types(page=${page.number}-1)}" th:unless="${page.first}"><span aria-hidden="true">&larr;</span>上一页</a>
                                    </li>
                                    <li>
                                        第 <span th:text="${page.number}+1"></span> 页  /
                                        总页数 <span th:text="${page.totalPages}"></span>
                                    </li>
                                    <li class="next">
                                        <a th:href="@{/admin/types(page=${page.number}+1)}" aria-label="Next" th:unless="${page.last}">下一页<span aria-hidden="true">&rarr;</span></a>
                                    </li>
                                </ul>
                            </nav>
                        </th>
                        <th>
                            <a class="btn btn-info btn-sm" th:href="@{/admin/types/input}" role="button" style="margin-top: 15px">新增</a>
                        </th>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>
</div><br>
<div th:replace="admin/adminblog::adminfooter"></div>

<script type="text/javascript">
    $('.dropdown-toggle').dropdown()
</script>

<script type="text/javascript">
    $("#newBlog-container").load(/*[[@{/footer/newBlog}]]*/"/footer/newBlog")
</script>
</body>
</html>